
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _CustomerRequests : SqlClientEntity
	{
		public _CustomerRequests()
		{
			this.QuerySource = "CustomerRequests";
			this.MappingName = "CustomerRequests";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_CustomerRequestsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_CustomerRequestsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Title
			{
				get
				{
					return new SqlParameter("@Title", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter Content
			{
				get
				{
					return new SqlParameter("@Content", SqlDbType.NText, 1073741823);
				}
			}
			
			public static SqlParameter Requestor
			{
				get
				{
					return new SqlParameter("@Requestor", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter CreatedDate
			{
				get
				{
					return new SqlParameter("@CreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Email
			{
				get
				{
					return new SqlParameter("@Email", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter Address
			{
				get
				{
					return new SqlParameter("@Address", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter Important
			{
				get
				{
					return new SqlParameter("@Important", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Unread
			{
				get
				{
					return new SqlParameter("@Unread", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string Title = "Title";
            public const string Content = "Content";
            public const string Requestor = "Requestor";
            public const string CreatedDate = "CreatedDate";
            public const string Deleted = "Deleted";
            public const string Email = "Email";
            public const string Address = "Address";
            public const string Important = "Important";
            public const string Unread = "Unread";
            public const string BranchID = "BranchID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _CustomerRequests.PropertyNames.ID;
					ht[Title] = _CustomerRequests.PropertyNames.Title;
					ht[Content] = _CustomerRequests.PropertyNames.Content;
					ht[Requestor] = _CustomerRequests.PropertyNames.Requestor;
					ht[CreatedDate] = _CustomerRequests.PropertyNames.CreatedDate;
					ht[Deleted] = _CustomerRequests.PropertyNames.Deleted;
					ht[Email] = _CustomerRequests.PropertyNames.Email;
					ht[Address] = _CustomerRequests.PropertyNames.Address;
					ht[Important] = _CustomerRequests.PropertyNames.Important;
					ht[Unread] = _CustomerRequests.PropertyNames.Unread;
					ht[BranchID] = _CustomerRequests.PropertyNames.BranchID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string Title = "Title";
            public const string Content = "Content";
            public const string Requestor = "Requestor";
            public const string CreatedDate = "CreatedDate";
            public const string Deleted = "Deleted";
            public const string Email = "Email";
            public const string Address = "Address";
            public const string Important = "Important";
            public const string Unread = "Unread";
            public const string BranchID = "BranchID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _CustomerRequests.ColumnNames.ID;
					ht[Title] = _CustomerRequests.ColumnNames.Title;
					ht[Content] = _CustomerRequests.ColumnNames.Content;
					ht[Requestor] = _CustomerRequests.ColumnNames.Requestor;
					ht[CreatedDate] = _CustomerRequests.ColumnNames.CreatedDate;
					ht[Deleted] = _CustomerRequests.ColumnNames.Deleted;
					ht[Email] = _CustomerRequests.ColumnNames.Email;
					ht[Address] = _CustomerRequests.ColumnNames.Address;
					ht[Important] = _CustomerRequests.ColumnNames.Important;
					ht[Unread] = _CustomerRequests.ColumnNames.Unread;
					ht[BranchID] = _CustomerRequests.ColumnNames.BranchID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string Title = "s_Title";
            public const string Content = "s_Content";
            public const string Requestor = "s_Requestor";
            public const string CreatedDate = "s_CreatedDate";
            public const string Deleted = "s_Deleted";
            public const string Email = "s_Email";
            public const string Address = "s_Address";
            public const string Important = "s_Important";
            public const string Unread = "s_Unread";
            public const string BranchID = "s_BranchID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string Title
	    {
			get
	        {
				return base.Getstring(ColumnNames.Title);
			}
			set
	        {
				base.Setstring(ColumnNames.Title, value);
			}
		}

		public virtual string Content
	    {
			get
	        {
				return base.Getstring(ColumnNames.Content);
			}
			set
	        {
				base.Setstring(ColumnNames.Content, value);
			}
		}

		public virtual string Requestor
	    {
			get
	        {
				return base.Getstring(ColumnNames.Requestor);
			}
			set
	        {
				base.Setstring(ColumnNames.Requestor, value);
			}
		}

		public virtual DateTime CreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.CreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.CreatedDate, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual string Email
	    {
			get
	        {
				return base.Getstring(ColumnNames.Email);
			}
			set
	        {
				base.Setstring(ColumnNames.Email, value);
			}
		}

		public virtual string Address
	    {
			get
	        {
				return base.Getstring(ColumnNames.Address);
			}
			set
	        {
				base.Setstring(ColumnNames.Address, value);
			}
		}

		public virtual bool Important
	    {
			get
	        {
				return base.Getbool(ColumnNames.Important);
			}
			set
	        {
				base.Setbool(ColumnNames.Important, value);
			}
		}

		public virtual bool Unread
	    {
			get
	        {
				return base.Getbool(ColumnNames.Unread);
			}
			set
	        {
				base.Setbool(ColumnNames.Unread, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_Title
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Title) ? string.Empty : base.GetstringAsString(ColumnNames.Title);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Title);
				else
					this.Title = base.SetstringAsString(ColumnNames.Title, value);
			}
		}

		public virtual string s_Content
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Content) ? string.Empty : base.GetstringAsString(ColumnNames.Content);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Content);
				else
					this.Content = base.SetstringAsString(ColumnNames.Content, value);
			}
		}

		public virtual string s_Requestor
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Requestor) ? string.Empty : base.GetstringAsString(ColumnNames.Requestor);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Requestor);
				else
					this.Requestor = base.SetstringAsString(ColumnNames.Requestor, value);
			}
		}

		public virtual string s_CreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.CreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedDate);
				else
					this.CreatedDate = base.SetDateTimeAsString(ColumnNames.CreatedDate, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_Email
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Email) ? string.Empty : base.GetstringAsString(ColumnNames.Email);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Email);
				else
					this.Email = base.SetstringAsString(ColumnNames.Email, value);
			}
		}

		public virtual string s_Address
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Address) ? string.Empty : base.GetstringAsString(ColumnNames.Address);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Address);
				else
					this.Address = base.SetstringAsString(ColumnNames.Address, value);
			}
		}

		public virtual string s_Important
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Important) ? string.Empty : base.GetboolAsString(ColumnNames.Important);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Important);
				else
					this.Important = base.SetboolAsString(ColumnNames.Important, value);
			}
		}

		public virtual string s_Unread
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Unread) ? string.Empty : base.GetboolAsString(ColumnNames.Unread);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Unread);
				else
					this.Unread = base.SetboolAsString(ColumnNames.Unread, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Title
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Content
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Content, Parameters.Content);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Requestor
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Requestor, Parameters.Requestor);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Email
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Email, Parameters.Email);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Address
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Important
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Important, Parameters.Important);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Unread
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Unread, Parameters.Unread);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public WhereParameter Content
		    {
				get
		        {
					if(_Content_W == null)
	        	    {
						_Content_W = TearOff.Content;
					}
					return _Content_W;
				}
			}

			public WhereParameter Requestor
		    {
				get
		        {
					if(_Requestor_W == null)
	        	    {
						_Requestor_W = TearOff.Requestor;
					}
					return _Requestor_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter Email
		    {
				get
		        {
					if(_Email_W == null)
	        	    {
						_Email_W = TearOff.Email;
					}
					return _Email_W;
				}
			}

			public WhereParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public WhereParameter Important
		    {
				get
		        {
					if(_Important_W == null)
	        	    {
						_Important_W = TearOff.Important;
					}
					return _Important_W;
				}
			}

			public WhereParameter Unread
		    {
				get
		        {
					if(_Unread_W == null)
	        	    {
						_Unread_W = TearOff.Unread;
					}
					return _Unread_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _Title_W = null;
			private WhereParameter _Content_W = null;
			private WhereParameter _Requestor_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _Email_W = null;
			private WhereParameter _Address_W = null;
			private WhereParameter _Important_W = null;
			private WhereParameter _Unread_W = null;
			private WhereParameter _BranchID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_Title_W = null;
				_Content_W = null;
				_Requestor_W = null;
				_CreatedDate_W = null;
				_Deleted_W = null;
				_Email_W = null;
				_Address_W = null;
				_Important_W = null;
				_Unread_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Title
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Title, Parameters.Title);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Content
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Content, Parameters.Content);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Requestor
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Requestor, Parameters.Requestor);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Email
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Email, Parameters.Email);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Address
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Important
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Important, Parameters.Important);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Unread
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Unread, Parameters.Unread);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter Title
		    {
				get
		        {
					if(_Title_W == null)
	        	    {
						_Title_W = TearOff.Title;
					}
					return _Title_W;
				}
			}

			public AggregateParameter Content
		    {
				get
		        {
					if(_Content_W == null)
	        	    {
						_Content_W = TearOff.Content;
					}
					return _Content_W;
				}
			}

			public AggregateParameter Requestor
		    {
				get
		        {
					if(_Requestor_W == null)
	        	    {
						_Requestor_W = TearOff.Requestor;
					}
					return _Requestor_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter Email
		    {
				get
		        {
					if(_Email_W == null)
	        	    {
						_Email_W = TearOff.Email;
					}
					return _Email_W;
				}
			}

			public AggregateParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public AggregateParameter Important
		    {
				get
		        {
					if(_Important_W == null)
	        	    {
						_Important_W = TearOff.Important;
					}
					return _Important_W;
				}
			}

			public AggregateParameter Unread
		    {
				get
		        {
					if(_Unread_W == null)
	        	    {
						_Unread_W = TearOff.Unread;
					}
					return _Unread_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _Title_W = null;
			private AggregateParameter _Content_W = null;
			private AggregateParameter _Requestor_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _Email_W = null;
			private AggregateParameter _Address_W = null;
			private AggregateParameter _Important_W = null;
			private AggregateParameter _Unread_W = null;
			private AggregateParameter _BranchID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_Title_W = null;
				_Content_W = null;
				_Requestor_W = null;
				_CreatedDate_W = null;
				_Deleted_W = null;
				_Email_W = null;
				_Address_W = null;
				_Important_W = null;
				_Unread_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerRequestsInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerRequestsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerRequestsDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Title);
			p.SourceColumn = ColumnNames.Title;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Content);
			p.SourceColumn = ColumnNames.Content;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Requestor);
			p.SourceColumn = ColumnNames.Requestor;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedDate);
			p.SourceColumn = ColumnNames.CreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Email);
			p.SourceColumn = ColumnNames.Email;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Address);
			p.SourceColumn = ColumnNames.Address;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Important);
			p.SourceColumn = ColumnNames.Important;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Unread);
			p.SourceColumn = ColumnNames.Unread;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
